<?php
    ob_start();

    if(file_exists('../../../definitions.inc.php')) include_once('../../../definitions.inc.php');
    define('ABSOLUTE_SERVER_DOCUMENT_ROOT','../../../admin/');

    include(ABSOLUTE_SERVER_DOCUMENT_ROOT.'session.inc');
    require_once(ABSOLUTE_SERVER_DOCUMENT_ROOT.'funct.inc');   
    
    require_once(ABSOLUTE_SERVER_DOCUMENT_ROOT.'functs.inc');
    require_once('adm_product_link.inc');
    include ABSOLUTE_SERVER_DOCUMENT_ROOT.'color_style.php';

    require_once('../../../classDB.inc.php');
    include '../../'.LANGUAGE;

    if(!GetAdminID($ID)){echo LOGIN_ERR; exit;}
    if(!Right_Check(4)){header('Location:'.ABSOLUTE_SERVER_DOCUMENT_ROOT.'error.php'); exit;}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>

<head>
	<?php echo '<meta http-equiv="Content-Type" content="text/html; charset='._CHARSET_.';">'; ?>
	
	<script language="JavaScript">
        <!--
	        function SubmitDataAndClosePage()
			{
	    		document.myform.submit();
	    		window.close();
	        }
    	//-->
    </script>
	
	<style  type="text/css"><!--
		table{
            border-bottom-color: black;
            border-top-color: black;
            border-left-color: black;
            border-right-color: black;
            border-collapse: collapse;
            font-size: 10px;
            font-family:  verdana;
        }
        form {margin-top:0pt; margin-bottom:0px;}
        img {margin-top:0pt; margin-bottom:0px;}
        body{
            margin-left:0pt;
            margin-right:0pt;
            margin-top:0pt;
            margin-bottom:0pt;
            font-family:  verdana;
            font-size: 10px;
        }
        textarea{
        	border: 0;
            background-color: white;
            margin-left:0pt;
            margin-right:0pt;
            margin-top:0pt;
            margin-bottom:0pt;
            font-family:  verdana;
            font-size: 10px;
        }
        input {
            border: 1px solid black;
            cursor: hand;
            background-color: white;
            font-size: 10px;
            margin-left: 0px;
            padding-left: 0px;
            list-style-type: none;
            font-family:  Verdana;
        }
        a {
		  	text-decoration: none; 
		  	font-weight: normal; 
		  	color:black; 
		  	font-size:10px;
		}
		a:hover {
		  	text-decoration: underline; 
			font-weight: normal; 
			color:#808080; 
			font-size:10px;
		}
    --></style>
</head>

<?php
	print "<body bgcolor=\"".Background_Color."\">";
		
	$Arr_Session		= explode("&-&",$_SESSION[PRODUCT_LINK_COOKIE]);
	$EMail_Text			= $Arr_Session[2];
		
do
{
    $_DB = new classDB();
    if (!$_DB->open()){echo OPEN_DB_ERR; break;}
  
	if($_REQUEST['read_default_values']=="YES")
		$EMail_Text = GetDefaultMailText($ID);

  	print "	  	
  			<table  style=\"width:100%;border:0px solid black;\">
				<tr style=\"background-color:".TR_BACKGOUND_COLOR_2.";\">
					<td>
						<b>".PL_ZADAJTE_DOPLNUJUCI_TEXT.":</b>
					</td>
				</tr>
				<tr>
					<td>
						<form name=\"myform\" action=\"adm_show_selected_products.php\" target=\"selected\" method=\"post\">
							<textarea name=\"New_Email_Text\" wrap=\"ON\" style=\"width:100%;height:130px;background-color:white;\">$EMail_Text</textarea>
							<input type=\"checkbox\" value=\"YES\" name=\"Text_Save_To_DB\" /> <b>".PL_PRI_VLOZENI_ZAPAMATAT_AKO_PREDDEFINOVANY_TEXT_IBA_PRE_MNA."</b>
						</form>
					</td>
				</tr>
				<tr>
					<td>							
						<input type=\"button\" value=\"".PL_VLOZIT_TEXT."\" style=\"width:100%;\" onclick=\"javascript:SubmitDataAndClosePage();\" />
					</td>
				</tr>
				<td>
					<br />
					<br />
					<form action=\"adm_compose_mail_text.php\" target=\"adm_compose_text\" method=\"post\">
						<input type=\"hidden\" value=\"YES\" name=\"read_default_values\" />
						<input type=\"submit\" value=\"".PL_NACITAT_PREDDEFINOVANY_TEXT."\" style=\"width:100%;\" />
					</form>
				</td>
			</table>
		
	";
}
while(false)
?>


</body>
</html>